<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Struct template call_if_statement&lt;true, Then, ThenResult&gt;</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0.0">
<link rel="up" href="../../reference.html#header.boost.contract.call_if_hpp" title="Header &lt;boost/contract/call_if.hpp&gt;">
<link rel="prev" href="call_if_statement_idm33861.html" title="Struct template call_if_statement&lt;true, Then, internal_type&gt;">
<link rel="next" href="call_if_statement_idm34007.html" title="Struct template call_if_statement&lt;true, Then, void&gt;">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="call_if_statement_idm33861.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_hpp"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="call_if_statement_idm34007.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.contract.call_if_statement_idm33902"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Struct template call_if_statement&lt;true, Then, ThenResult&gt;</span></h2>
<p>boost::contract::call_if_statement&lt;true, Then, ThenResult&gt; — Template specialization to handle static predicates that are <code class="computeroutput">true</code> for then-branch functor template calls that do not return void (not needed on C++17 compilers, use <code class="computeroutput">if constexpr</code> instead). </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../reference.html#header.boost.contract.call_if_hpp" title="Header &lt;boost/contract/call_if.hpp&gt;">boost/contract/call_if.hpp</a>&gt;

</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Then<span class="special">,</span> <span class="keyword">typename</span> ThenResult<span class="special">&gt;</span> 
<span class="keyword">struct</span> <a class="link" href="call_if_statement_idm33902.html" title="Struct template call_if_statement&lt;true, Then, ThenResult&gt;">call_if_statement</a><span class="special">&lt;</span><span class="keyword">true</span><span class="special">,</span> <span class="identifier">Then</span><span class="special">,</span> <span class="identifier">ThenResult</span><span class="special">&gt;</span> <span class="special">{</span>
  <span class="comment">// <a class="link" href="call_if_statement_idm33902.html#boost.contract.call_if_statement_idm33902construct-copy-destruct">construct/copy/destruct</a></span>
  <span class="keyword">explicit</span> <a class="link" href="call_if_statement_idm33902.html#idm33995-bb"><span class="identifier">call_if_statement</span></a><span class="special">(</span><span class="identifier">Then</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="call_if_statement_idm33902.html#idm33929-bb">public member functions</a></span>
  <a class="link" href="call_if_statement_idm33902.html#idm33930-bb"><span class="keyword">operator</span> <span class="identifier">ThenResult</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Else<span class="special">&gt;</span> <span class="identifier">ThenResult</span> <a class="link" href="call_if_statement_idm33902.html#idm33933-bb"><span class="identifier">else_</span></a><span class="special">(</span><span class="identifier">Else</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">bool</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">&gt;</span> 
    <a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special">&lt;</span> <span class="keyword">true</span><span class="special">,</span> <span class="identifier">Then</span><span class="special">,</span> <span class="identifier">ThenResult</span> <span class="special">&gt;</span> 
    <a class="link" href="call_if_statement_idm33902.html#idm33950-bb"><span class="identifier">else_if_c</span></a><span class="special">(</span><span class="identifier">ElseIfThen</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">&gt;</span> 
    <a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special">&lt;</span> <span class="keyword">true</span><span class="special">,</span> <span class="identifier">Then</span><span class="special">,</span> <span class="identifier">ThenResult</span> <span class="special">&gt;</span> 
    <a class="link" href="call_if_statement_idm33902.html#idm33973-bb"><span class="identifier">else_if</span></a><span class="special">(</span><span class="identifier">ElseIfThen</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idm35089"></a><h2>Description</h2>
<p>Usually this class template is instantiated only via the return value of  <code class="computeroutput"><a class="link" href="call_if.html" title="Function template call_if">boost::contract::call_if</a></code> and <code class="computeroutput"><a class="link" href="call_if_c.html" title="Function template call_if_c">boost::contract::call_if_c</a></code>.</p>
<p><span class="bold"><strong>See Also:</strong></span></p>
<p> <a class="link" href="../../boost_contract/extras.html#boost_contract.extras.assertion_requirements__templates_" title="Assertion Requirements (Templates)">
        Assertion Requirements</a></p>
<p>
</p>
<p>

</p>
<div class="refsect2">
<a name="idm35101"></a><h3>Template Parameters</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> Then</pre>
<p>Type of functor template to call when the static predicate is <code class="computeroutput">true</code> (as it is for this template specialization). </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> ThenResult</pre>
<p>Non-void return type of the then-branch functor template call. </p>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="idm35117"></a><h3>
<a name="boost.contract.call_if_statement_idm33902construct-copy-destruct"></a><code class="computeroutput">call_if_statement</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<pre class="literallayout"><span class="keyword">explicit</span> <a name="idm33995-bb"></a><span class="identifier">call_if_statement</span><span class="special">(</span><span class="identifier">Then</span> f<span class="special">)</span><span class="special">;</span></pre>Construct this object with the then-branch functor template. <p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
<td><p>Then-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is actually compiled and executed for this template specialization (because the if-statement static predicate is <code class="computeroutput">true</code>). The return type of <code class="computeroutput">f()</code> must be the same as (or implicitly convertible to) the <code class="computeroutput">ThenResult</code> type. </p></td>
</tr></tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li></ol></div>
</div>
<div class="refsect2">
<a name="idm35147"></a><h3>
<a name="idm33929-bb"></a><code class="computeroutput">call_if_statement</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="idm33930-bb"></a><span class="keyword">operator</span> <span class="identifier">ThenResult</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>This implicit type conversion returns a copy of the value returned by the call to the then-branch functor template. </li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Else<span class="special">&gt;</span> <span class="identifier">ThenResult</span> <a name="idm33933-bb"></a><span class="identifier">else_</span><span class="special">(</span><span class="identifier">Else</span> <span class="keyword">const</span> <span class="special">&amp;</span> f<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Specify the else-branch functor template. <p>

</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
<td><p>Else-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is never compiled or executed for this template specialization (because the if-statement static predicate is <code class="computeroutput">true</code>). The return type of <code class="computeroutput">f()</code> must be the same as (or implicitly convertible to) the <code class="computeroutput">ThenResult</code> type.</p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>A copy of the value returned by the call to the then-branch functor template (because the else-branch functor template call is not executed). </p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">bool</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">&gt;</span> 
  <a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special">&lt;</span> <span class="keyword">true</span><span class="special">,</span> <span class="identifier">Then</span><span class="special">,</span> <span class="identifier">ThenResult</span> <span class="special">&gt;</span> 
  <a name="idm33950-bb"></a><span class="identifier">else_if_c</span><span class="special">(</span><span class="identifier">ElseIfThen</span> <span class="keyword">const</span> <span class="special">&amp;</span> f<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Specify an else-if-branch functor template (using a static boolean predicate). <p>


</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
<td><p>Else-if-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is never compiled or executed for this template specialization (because the if-statement static predicate is <code class="computeroutput">true</code>). The return type of <code class="computeroutput">f()</code> must be the same as (or implicitly convertible to) the <code class="computeroutput">ThenResult</code> type.</p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Template Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">ElseIfPred</code></span></p></td>
<td><p>Static boolean predicate selecting which functor template call to compile and execute.</p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>A call-if statement so the else statement and additional else-if statements can be specified if needed. Eventually, it will be the return value of the then-branch functor template call for this template specialization (because the if-statement static predicate is <code class="computeroutput">true</code>). </p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">&gt;</span> 
  <a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special">&lt;</span> <span class="keyword">true</span><span class="special">,</span> <span class="identifier">Then</span><span class="special">,</span> <span class="identifier">ThenResult</span> <span class="special">&gt;</span> 
  <a name="idm33973-bb"></a><span class="identifier">else_if</span><span class="special">(</span><span class="identifier">ElseIfThen</span> <span class="keyword">const</span> <span class="special">&amp;</span> f<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Specify an else-if-branch functor template (using a nullary boolean meta-function). <p>


</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
<td><p>Else-if-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is never compiled or executed for this template specialization (because the if-statement static predicate is <code class="computeroutput">true</code>). The return type of <code class="computeroutput">f()</code> must be the same as (or implicitly convertible to) the <code class="computeroutput">ThenResult</code> type.</p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Template Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">ElseIfPred</code></span></p></td>
<td><p>Nullary boolean meta-function selecting which functor template call to compile and execute.</p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>A call-if statement so the else statement and additional else-if statements can be specified if needed. Eventually, it will be the return value of the then-branch functor template call for this template specialization (because the if-statement static predicate is <code class="computeroutput">true</code>). </p></td>
</tr>
</tbody>
</table></div>
</li>
</ol></div>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2008-2019 Lorenzo Caminiti<p>
        Distributed under the Boost Software License, Version 1.0 (see accompanying
        file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="call_if_statement_idm33861.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_hpp"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="call_if_statement_idm34007.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
